# Maintainer: David Runge <dvzrv@archlinux.org>
# Contributor: Ray Rashif <schiv@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Roman Kyrylych <roman@archlinux.org>
# Contributor: scippio <scippio@seznam.cz>

pkgname=libconfig
pkgver=1.7.3
pkgrel=2
pkgdesc="C/C++ Configuration File Library"
arch=(loong64 x86_64)
url="https://github.com/hyperrealm/libconfig"
license=(LGPL2.1)
depends=(
  gcc-libs
  glibc
)
makedepends=(texinfo)
provides=(
  libconfig++.so
  libconfig.so
)
source=($url/archive/v$pkgver/$pkgname-v$pkgver.tar.gz)
sha512sums=('3749bf9eb29bab0f6b14f4fc759f0c419ed27a843842aaabed1ec1fbe0faa8c93322ff875ca1291d69cb28a39ece86d512aec42c2140d566c38c56dc616734f4')
b2sums=('94301be4d6e472fc9daeac7a04074855737ddda94bb5748cd0087fafe192cf674ea1c020808ebf855372188b6b27a57ed185323fa26988bb1fccde0566617cba')

prepare() {
  cd $pkgname-$pkgver
  autoreconf -fiv
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr
  # prevent excessive overlinking due to libtool
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  make DESTDIR="$pkgdir" install -C $pkgname-$pkgver
  rm "$pkgdir/usr/share/info/dir"
  install -vDm 644 $pkgname-$pkgver/{AUTHORS,ChangeLog,NEWS,README,TODO} -t "$pkgdir/usr/share/doc/$pkgname/"
}
# vim:set ts=2 sw=2 et:
